import wepy from 'wepy'
export default class extends wepy.mixin {
  data = {
    swiperList: [],
    coteList: [],
    floorList: []
  }
  onLoad() {
    this.getSwiperData()
    this.getCoteList()
    this.getFloorList()
  }
  methods = {
    goGoodsList(url) {
      wepy.navigateTo({
        url
      })
    }
  }
  async getSwiperData() {
    const { data: res } = await wepy.getData('/home/swiperdata')
    if (res.meta.status !== 200) {
      return wepy.baseToast()
    }
    this.swiperList = res.message
    this.$apply()
  }
  async getCoteList() {
    const { data: res } = await wepy.getData('/home/catitems')
    if (res.meta.status !== 200) {
      return wepy.baseToast()
    }
    this.coteList = res.message
    this.$apply()
  }
  async getFloorList() {
    const { data: res } = await wepy.getData('/home/floordata')
    if (res.meta.status !== 200) {
      return wepy.baseToast()
    }
    this.floorList = res.message
    this.$apply()
    console.log(this.floorList)
  }
}
